using System.Text.RegularExpressions;
using System.Web;

namespace DynamicConfigurationManager.ConfigMapAttributes
{
    /// <summary>
    /// SitePathRegEx compares the attribute value to the fully qualified path of the Site's AppDomain Path.
    /// </summary>
    internal class SitePathRegEx : IConfigMapAttribute
    {
        public bool Execute( string configMapAttribute )
        {
            var sitePath = HttpRuntime.AppDomainAppPath;
            LogHelper.Append( "SitePathRegEx: matching to {0}", sitePath );
            var re = new Regex( configMapAttribute, RegexOptions.IgnoreCase );
            return re.IsMatch( sitePath );
        }
    }
}